package com.woniuxy.oldmanapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.oldmanapi.entity.OlderPulse;
import com.woniuxy.oldmanapi.mapper.OlderPulseMapper;
import com.woniuxy.oldmanapi.vo.HeightVo;
import com.woniuxy.oldmanapi.vo.PulseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PulseService {

    @Autowired
    OlderPulseMapper olderPulseMapper ;

    public PageInfo<PulseVo> findPulseByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<PulseVo> PulseVoList =  olderPulseMapper.selectPulseByName(name);
        return new PageInfo<>(PulseVoList);
    }

    public void add(OlderPulse olderPulse) {
        olderPulseMapper.insert(olderPulse);
    }

    public void delete(int id) {
        olderPulseMapper.deleteByPrimaryKey(id);
    }

    public void modify(OlderPulse olderPulse) {
        olderPulseMapper.updateByPrimaryKey(olderPulse);
    }
    public PulseVo selectOne(int id) {
        return olderPulseMapper.selectOneByName(id);
    }
}
